

<?php $sumados=0.00;?>
<div id="presentacion">
    <h1>Gastos de estadía y consumos</h1>
    <div class="ui-datagrid">
    <input type="hidden" id="id_reserva" name="id_reserva" type="text" class="ui-widget-content"
   <?php  echo ' value ="'. $pagos->id_reserva . '"';?> >
    <table border="1" >
        <thead><tr >
            <th>ID</th>
            <th>HABITACION</th>
            <th>PASAJERO</th>
            <th>FECHA LLEGADA</th>
            <th>FECHA SALIDA</th>
            <th>CANTIDAD DIAS</th>
            <th>SUBTOTAL</th>
        </tr></thead> 
        <tbody id="pagos">
        
        <tr>
            <td><?php echo $pagos->id_reserva?></td>
            <td><?php echo $pagos->habitacion?></td>;
            <td><?php echo $pagos->apellido?>, <?php echo $pagos->nombre?></td>
            <td><?php echo $pagos->fecha_llegada?> </td>
            <td><?php echo $pagos->fecha_salida?> </td>
            <td><?php echo $pagos->dias?></td>
            <td><?php echo $pagos->monto_total?></td>
        </tr>       
    </tbody>
        </table>
</div>
    <div class="ui-datagrid" >
               
    <table border="1" >
        <thead><tr >
            <th>ID</th>
            <th>HABITACION</th>
            <th>SERVICIO</th>
            <th>FECHA</th>
            <th>DESCRIPCION</th>
            <th>PRECIO</th>
        </tr></thead> 
        <tbody id="gastos">
    <?php foreach ($gastos as $fila)        
    {
        ?>
        
        <tr>
            <td><?php echo $fila->id?></td>
            <td><?php echo $fila->habitacion?></td>
            <td><?php echo $fila->tipos?></td>
            <td> <?php echo $fila->fecha?></td>
            <td><?php echo $fila->observacion?></td>
            <td><?php echo $fila->precio?>  </td>
            
       
        </tr>       
        <?php
    }
    foreach ($gastos as $fila){ 
        $sumados = $sumados+($fila->precio); 
    }
    $totales=$sumados+($reserva->total)-($reserva->senia);
    ?></tbody>
        </table>
</div>
<form class="cmxform" id="signupForm" method="post" <?php 
          echo 'accion = "' . base_url() . 'cpago/eliminar"'; ?> novalidate="novalidate">
    <fieldset class="ui-widget ui-widget-content ui-corner-all">

    <p>
         <label for="cobrar">LATE CHECKOUT: $ <?php echo $pagos->late_checkout;?> -</label>
           <label for="cobrar">TOTAL RESERVAS: $ <?php echo $reserva->total;?> - </label>
           <label for="cobrar">MONTO SEÑA: $ <?php echo $reserva->senia;?> -</label>
          <label for="cobrar">TOTAL CONSUMOS: $ <?php echo $sumados;?> -</label>
        <label for="cobrar">TOTAL COBRADO: $ <?php echo $totales;?></label>
			
    </p>
    <p>
            <label for="cobrar">FECHA DE PAGO: <?php echo $pagos->fecha_pago;?></label>
			
    </p>
</div>

</fieldset>
</form>
   <button onclick="redireccionar()" >Anular Pago</button>
    
<link rel="stylesheet" type="text/css" media="screen" href="<?php echo base_js(); ?>jquery-ui-git.css">
 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> 
 <script src="<?php echo base_js(); ?>jquery.validate.min.js"></script>
 <script src="<?php echo base_js(); ?>jquery-ui-git.js"></script> 
 <script>
     function redireccionar()
     {

         var idres= document.getElementById("id_reserva");
         window.location.href = "<?php echo base_url();?>cpago/anular/"+idres.getAttribute("value"); 
     }    

     </script>